<template>
  <div>
    comp
    {{ s1 }}
  </div>
</template>

<script>
import { ref, onMounted} from "@vue/composition-api";

export default {
  setup(props, ctx) {
    console.log("setup也不会因为其内部创建的响应式数据发生改变而重新执行");
    const s1 = ref(0);

    onMounted(() => {
      setInterval(() => {
        s1.value++;
      }, 1000);
    });
    return {
      s1
    };
  }
};
</script>

<style lang="scss" scoped></style>
